<template>
  <van-row>
    <van-col span="24">
      <tab :line-width=2 :scroll-threshold='5'>
        <tab-item @on-item-click="tabChange(comList[index])" v-for="(item, index) in list" :selected="index===$store.state.toolindex" :key="index">{{item}}</tab-item>
      </tab>
    </van-col>
  </van-row>
</template>

<script>
import { Tab, TabItem, Sticky } from 'vux'
export default {
  data() {
    return {
      list: ['搜索', '热点', '国内', '国际'],
      comList: ['Search', 'Hot', 'Inland', 'International']
    }
  },
  props: ['index'],
  components: {
    Tab, TabItem, Sticky
  },
  methods: {
    log(index) {
      console.log(index)
    },
    tabChange: function(tab) {
      this.$store.state.tabView = tab
    }
  }
}
</script>

<style>

</style>
